﻿package game.objects {
	import alternativa.engine3d.core.Object3D;
	import game.global.Global;
	import game.lang.Lang;
	import game.context.Context;
	import game.debug.Debug;
	import game.socket.Sockets;
	import game.Config;
	import game.music.Music;
	import flash.display.Stage3D;
	import flash.display3D.Context3D;
	
	public class Game3DObject extends Object3D {
		
		public function deleteAll():void { while (this.numChildren) removeChildAt(0); }
		
		public function set socket(value:Sockets):void { global.socket = value; }
		
		public function get socket():Sockets { return global.socket as Sockets; }
		
		public function debug(text:String, type:String = ""):void { Debug.log(text, type); }
		
		public function set context(value:Context):void { global.context = value; }
		
		public function get context():Context { return global.context as Context; }
		
		public function set lang(value:Lang):void { global.lang = value; }
		
		public function get lang():Lang { return global.lang as Lang; }
		
		public function set config(value:Config):void { global.config = value; };
		
		public function get config():Config { var conf:Config; if (!global) conf = new Config; else if (!global.config) { conf = new Config; global.config = conf; } else conf = global.config as Config; return conf; }
		
		private function get global():Global { return Global.getInstance(); }
		
		public function set stage3D(value:Stage3D) { global.stage3d = value; }
		
		public function get stage3D():Stage3D { return global.stage3d; }
		
		public function set context3D(value:Context3D) { global.context3d = value; }
		
		public function get context3D():Context3D { return global.context3d; }
		
		public function set music(value:Music):void { global.music = value; }
		
		public function get music():Music { return global.music as Music; }
		
	}
}